package com.billdowney.controller.media;

import java.io.OutputStream;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.billdowney.annotation.AuthRoleAllowed;
import com.billdowney.annotation.SystemLogInfo;
import com.billdowney.controller.BaseController;
import com.billdowney.service.interfaces.media.VideoService;
import com.billdowney.util.log.SystemLogHandleType;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;

/**
 * @ClassName: VideoController
 * @Description: 视频控制器
 * @author 超级小富翁 - BillDowney
 * @date 2018年7月31日 下午4:01:18
 */
@RestController
@RequestMapping(value = "/video", method = { RequestMethod.POST, RequestMethod.GET })
@Api(tags = "视频控制器")
public class VideoController extends BaseController {

	@Autowired
	private VideoService videoService;

	@AuthRoleAllowed
	@RequestMapping(value = "/getVideoFile")
	@SystemLogInfo(value = "获取视频内容：{id}", handleType = SystemLogHandleType.find)
	@ApiOperation(value = "获取视频内容", notes = "获取一个包含视频的流信息", response = OutputStream.class)
	@ApiImplicitParam(name = "id", value = "文件id", required = true)
	public void getVideoFile(@RequestParam String id) throws Exception {
		videoService.getVideoFileByFileId(id, request, response);
	}
}
